const path = require("path");

module.exports = {
  publicPath: "./",
  runtimeCompiler: true,
  css: {
    loaderOptions: {
      // 给 less-loader 传递选项
      less: {
        javascriptEnabled: true,
      },
    },
  },
  configureWebpack: (config) => {
    return {
      resolve: {
        alias: {
          "@lib": path.resolve(__dirname, "./lib"),
          "@util": path.resolve(__dirname, "./lib/_util"),
          "@style": path.resolve(__dirname, "./lib/styles"),
        },
      },
      module: {
        rules: [
          {
            test: /\.md$/,
            use: [
              {
                loader: "vue-loader",
                options: {
                  compilerOptions: {
                    preserveWhitespace: false,
                  },
                },
              },
              {
                loader: path.resolve(__dirname, "./src/loader/index.js"),
              },
            ],
          },
        ],
      },
      performance: {
        hints: "warning",
        maxEntrypointSize: 50000000,
        maxAssetSize: 30000000,
        assetFilter(assetFilename) {
          return assetFilename.endsWith(".js");
        },
      },
    };
  },
  chainWebpack: (config) => {
    //忽略的打包文件
    config.externals({
      vue: "Vue",
      "vue-router": "VueRouter",
      "element-ui": "ELEMENT",
    });
  },
};
